package nc.vo.qc.c013.entity;

import nc.vo.pub.CircularlyAccessibleValueObject;
import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill;
import nc.vo.pubapp.pattern.model.meta.entity.bill.BillMetaFactory;
import nc.vo.pubapp.pattern.model.meta.entity.bill.IBillMeta;
import nc.vo.qc.c011.entity.MetApplyHeaderVO;
import nc.vo.qc.c011.entity.MetApplyItemVO;
import nc.vo.qc.c011.entity.MetApplySourceItemVO;
import nc.vo.trade.pub.IExAggVO;

@nc.vo.annotation.AggVoInfo(parentVO = "nc.vo.qc.c013.entity.MetReportHeaderVO")

public class AggMetReportHeaderVO extends AbstractBill implements IExAggVO {

	@Override
	public IBillMeta getMetaData() {
		IBillMeta billMeta = BillMetaFactory.getInstance().getBillMeta(AggMetReportHeaderVOMeta.class);
		return billMeta;
	}

	@Override
	public MetReportHeaderVO getParentVO() {
		return (MetReportHeaderVO) this.getParent();
	}

	public MetReportItemVO[] getItemVO() {
		return (MetReportItemVO[]) getChildren(MetReportItemVO.class);
	}

	public MetReportSourceItemVO[] getSourceItemVO() {
		return (MetReportSourceItemVO[]) getChildren(MetReportSourceItemVO.class);
	}

	@Override
	public String[] getTableCodes() {
		String[] codes = new String[2];
		codes[0] = "pk_reportbill_b";
		codes[1] = "pk_reportbill_s";
		return codes;
	}

	@Override
	public String[] getTableNames() {
		String[] codes = new String[2];
		codes[0] = "pk_reportbill_b";
		codes[1] = "pk_reportbill_s";
		return codes;
	}

	public void setItemVO(MetReportItemVO[] item) {
		setChildren(MetReportItemVO.class, item);
	}

	public void setSourceItemVO(MetReportSourceItemVO[] sourceItem) {
		setChildren(MetReportSourceItemVO.class, sourceItem);
	}

	public void setParentVO(MetReportHeaderVO hvo) {
		setParent(hvo);
	}

	public void setTableVO(String tableCode, CircularlyAccessibleValueObject[] values) {
		if ("met_qc_reportbill_b".equalsIgnoreCase(tableCode) || "pk_reportbill_b".equalsIgnoreCase(tableCode)) {
			this.setItemVO((MetReportItemVO[]) values);
		}
		if ("met_qc_reportbill_s".equalsIgnoreCase(tableCode) || "pk_reportbill_s".equalsIgnoreCase(tableCode)) {
			this.setSourceItemVO((MetReportSourceItemVO[]) values);
		}
	}

	public CircularlyAccessibleValueObject[] getTableVO(String tableCode) {
		if ("met_qc_reportbill_b".equalsIgnoreCase(tableCode) || "pk_reportbill_b".equalsIgnoreCase(tableCode)) {
			return this.getItemVO();
		}
		if ("met_qc_reportbill_s".equalsIgnoreCase(tableCode) || "pk_reportbill_s".equalsIgnoreCase(tableCode)) {
			return this.getSourceItemVO();
		}
		return null;
	}

}